package com.zzw.testdemo01.registry;

import com.zzw.testdemo01.container.CustomContainerOne;
import net.minecraft.inventory.container.ContainerType;
import net.minecraftforge.common.extensions.IForgeContainerType;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.network.IContainerFactory;

@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
public class GuiModRegistry {

    private static final IContainerFactory<CustomContainerOne> FACTORY = (windowId, inv, data) ->
            new CustomContainerOne(windowId, inv);

    public static final ContainerType<CustomContainerOne> CUSTOM_CONTAINER_TYPE =
            IForgeContainerType.create(FACTORY);

    @SubscribeEvent
    public static void onContainerRegistry(final RegistryEvent.Register<ContainerType<?>> event) {
        event.getRegistry().register(CUSTOM_CONTAINER_TYPE.setRegistryName("container1"));
    }

}
